package com.xqt.service;

import com.xqt.base.dao.BaseDao;
import com.xqt.base.service.BaseService;
import com.xqt.dao.sys.SysMenuDao;
import com.xqt.entity.sys.SysMenu;
import com.xqt.entity.sys.SysMenuBtn;
import com.xqt.inters.service.sys.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/3/15.
 */
public class SysMenuService extends BaseService<SysMenu> implements ISysMenuService {
    @Autowired
    private SysMenuDao sysMenuDao;

    @Override
    public SysMenu queryById(String id) {
        return sysMenuDao.queryById(id);
    }


    public void delete(Object... ids) throws Exception {
        if (ids == null || ids.length < 1) {
            return;
        }
        for (Object id : ids) {
//            // 获取按钮权限
//            SysMenuBtn btn = new SysMenuBtn();
//            btn.setMenuId(String.valueOf(id));
//            btn.getPager().setLimitDirection(false);
//            List<SysMenuBtn> btnList = this.sysMenuBtnDao.queryByList(btn);
//            if (btnList != null && btnList.size() > 0) {
//                for (SysMenuBtn menuBtn : btnList) {
//                    this.sysRoleDao.deleteRoleMenuByMenuId(menuBtn.getId());
//                    this.sysMenuBtnDao.delete(menuBtn.getId());
//                }
//            }
//            this.sysRoleDao.deleteRoleMenuByMenuId(id);
            sysMenuDao.delete(id);
        }
    }


}
